package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.mappers.TestSoulMapper;
import com.tanhua.model.domain.TestSoul;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class TestSoulApiImpl implements TestSoulApi{

    @Autowired
    private TestSoulMapper testSoulMapper;

    @Override
    public List<TestSoul> findAll() {

        QueryWrapper qw = new QueryWrapper();

        qw.orderByDesc();

        List list = testSoulMapper.selectList(qw);

        return list;
    }

    @Override
    public Long selectId(int size) {
        QueryWrapper<TestSoul> wrapper = new QueryWrapper<>();
        wrapper.eq("num",size);
        TestSoul testSoul = testSoulMapper.selectOne(wrapper);
        return testSoul.getId();
    }
}
